when an in-link is created?

Hi,

I need to find when an in-link is created.

For this I am iterating in links for an object. From an in-link, i get source of an object. Navigating through object history for the source object and checking for "createLink" history type, I am able to find the creation of links (this means out links in history).

However, I am not able to find, if the "out link" of source object history matches my in-link.

Is there a way, to get "link object" by navigating object history? or can I get info, when an in-link is created using an alternative approach?

anil.
SystemAdmin - Thu Jun 04 13:21:31 EDT 2009

Re: when an in-link is created?
Ron_Lewis - Thu Jun 04 13:52:17 EDT 2009

Easiest way for you to learn how is: Use analysis wizard and create a column showing incoming links and select in the link attributes selection box the link creation date attribute.

Then examine the code till you have it memorized.

Re: when an in-link is created?
SystemAdmin - Fri Jun 05 03:07:03 EDT 2009

Ron_Lewis - Thu Jun 04 13:52:17 EDT 2009
Easiest way for you to learn how is: Use analysis wizard and create a column showing incoming links and select in the link attributes selection box the link creation date attribute.

Then examine the code till you have it memorized.

Hi,
I did not understand how this solves my problem. I want to find how to get the information programatically using DXL, not by manually looking at information in the DOORS clients.

Just for background, I am developing sensor scripts to monitor requirements specifications. For this, I am doing an automated analysis of history using dxl.

Anil.

Re: when an in-link is created?
Tony_Goodman - Fri Jun 05 03:22:15 EDT 2009

SystemAdmin - Fri Jun 05 03:07:03 EDT 2009
Hi,
I did not understand how this solves my problem. I want to find how to get the information programatically using DXL, not by manually looking at information in the DOORS clients.

Just for background, I am developing sensor scripts to monitor requirements specifications. For this, I am doing an automated analysis of history using dxl.

Anil.

This solves your problem by generating the code for you!
The following is code generated using the analysis wizard. I have modified it to work on the current object only. It displays the creation time of in-links.

Object o = current
    Object othero = null
    ModuleVersion otherVersion = null
    ModName_ otherMod = null
    LinkRef lr = null
    Link l = null
 
 
    for lr in all(o<-"*") do {
        otherMod = module (sourceVersion lr)
        if (!null otherMod) {
            if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
                load((sourceVersion lr),false)
            }
        }
    }
 
    for l in all(o<-"*") do {
        otherVersion = sourceVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = source l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = source l
        if (null othero) continue
        if (isDeleted othero) continue
 
 
 
            print("Link created from object " othero."Absolute Number" " ")
            print(l."Created By" " ")
            print(l."Created On" "\n")
        }

 


Playing with history can get complicated. I would suggest that unless you are experienced with DXL, stick to getting information from the built-in attributes "Last Modified By", "Last Modified On" etc. These should provide enough information to monitor changes.

 

Re: when an in-link is created?
IBM_Gust - Sat Jun 06 08:20:09 EDT 2009

Tony_Goodman - Fri Jun 05 03:22:15 EDT 2009

This solves your problem by generating the code for you!
The following is code generated using the analysis wizard. I have modified it to work on the current object only. It displays the creation time of in-links.

Object o = current
    Object othero = null
    ModuleVersion otherVersion = null
    ModName_ otherMod = null
    LinkRef lr = null
    Link l = null
 
 
    for lr in all(o<-"*") do {
        otherMod = module (sourceVersion lr)
        if (!null otherMod) {
            if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
                load((sourceVersion lr),false)
            }
        }
    }
 
    for l in all(o<-"*") do {
        otherVersion = sourceVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        othero = source l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = source l
        if (null othero) continue
        if (isDeleted othero) continue
 
 
 
            print("Link created from object " othero."Absolute Number" " ")
            print(l."Created By" " ")
            print(l."Created On" "\n")
        }

 


Playing with history can get complicated. I would suggest that unless you are experienced with DXL, stick to getting information from the built-in attributes "Last Modified By", "Last Modified On" etc. These should provide enough information to monitor changes.

 

Hey Tony, you would make a great fishing instructor. Everyone would come home with a fish. We don’t need any more stinking fishermen.

Re: when an in-link is created?
SystemAdmin - Thu Jun 11 21:28:59 EDT 2009

IBM_Gust - Sat Jun 06 08:20:09 EDT 2009
Hey Tony, you would make a great fishing instructor. Everyone would come home with a fish. We don’t need any more stinking fishermen.

Hi Tony,

This is a very good script to get the history of the source objects.

I have a couple of queries on the details of the code:

if (null othero) {
load(otherVersion,false)
}
Do you mean "if (!null othero)" ?

Then "othero = source l" is declared a second time.

Is there any significance for the above code which I am not able to understand?

  • Krishna

Re: when an in-link is created?
Tony_Goodman - Fri Jun 12 02:36:27 EDT 2009

SystemAdmin - Thu Jun 11 21:28:59 EDT 2009
Hi Tony,

This is a very good script to get the history of the source objects.

I have a couple of queries on the details of the code:

if (null othero) {
load(otherVersion,false)
}
Do you mean "if (!null othero)" ?

Then "othero = source l" is declared a second time.

Is there any significance for the above code which I am not able to understand?

  • Krishna

The code uses a "belt and braces" approach to ensure that the source module is open and that we don't get a a null Obejct handle. Null references cause nasty DXL errors and are to be avoided at all costs, that's why all code should routinely check for null before accessing any variables.

The LinkRef loop is used to identify and open the source modules.

The in-Link loop is the used to access the source objects. The source object is checked for null, and if it is null then this may be due to the source module not being open, so it is loaded. Then the source Object handle is refreshed.

The code still works without this second check, but is safer to leave it there.

Re: when an in-link is created?
SystemAdmin - Fri Jun 12 10:32:05 EDT 2009

Tony_Goodman - Fri Jun 12 02:36:27 EDT 2009
The code uses a "belt and braces" approach to ensure that the source module is open and that we don't get a a null Obejct handle. Null references cause nasty DXL errors and are to be avoided at all costs, that's why all code should routinely check for null before accessing any variables.

The LinkRef loop is used to identify and open the source modules.

The in-Link loop is the used to access the source objects. The source object is checked for null, and if it is null then this may be due to the source module not being open, so it is loaded. Then the source Object handle is refreshed.

The code still works without this second check, but is safer to leave it there.

Hi Tony,

Thanks for the explanation.

  • Krishna